<?php include 'includes/pagetop.php';?>
	
<?php include 'includes/navigation.php';?>

<?php include 'includes/tabletopcontainer.php';?>


<script type="text/javascript">

		$(function() {
			$("#orderdate").datepicker();

		}
	</script>

{message}

<?php if ($action == ''): ?>
	    <div id="content-table-inner">
	    
			<strong><a href="{url}/{page}/create"></>Create New {caption}</a></strong>
			<!--  start table-content  -->
			<div id="table-content">
				<form id="mainform" action="">
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
					<tr>
						<th class="table-header-check"><a id="toggle-all" ></a> </th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">Code</a>	</th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">Name</a></th>
						<th class="table-header-repeat line-left"><a href="">Description</a></th>
						<th class="table-header-options line-left"><a href="">Options</a></th>
					</tr>
					<?php if (isset($dealList)): ?>
						{dealList}
						<tr class="alternate-row">
							<td><input  type="checkbox"/></td>
							<td>{tenant_name}</td>
							<td>{item_name}</td>
							<td>{deal_discount}</td>
							<td class="options-width">
							<a href="{url}/{page}/edit/{deal_id}" title="Edit" class="icon-1 info-tooltip"></a>
							<a href="{url}/{page}/delete/{deal_id}" title="Delete" class="icon-2 info-tooltip"></a>
							</td>
						</tr>
						{/dealList}
					<?php endif; ?>
				</table>
				<!--  end product-table................................... --> 
				</form>
			</div>
			<!--  end content-table  -->
		
			<!--  start actions-box ............................................... -->
			<div id="actions-box">
				<a href="" class="action-slider"></a>
				<div id="actions-box-slider">
					<a href="" class="action-edit">Edit</a>
					<a href="" class="action-delete">Delete</a>
				</div>
				<div class="clear"></div>
			</div>
			<!-- end actions-box........... -->
			
			<!--  start paging..................................................... -->
			<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
			<tr>
			<td>
				<a href="" class="page-far-left"></a>
				<a href="" class="page-left"></a>
				<div id="page-info">Page <strong>1</strong> / 15</div>
				<a href="" class="page-right"></a>
				<a href="" class="page-far-right"></a>
			</td>
			<td>
			<select  class="styledselect_pages">
				<option value="">Number of rows</option>
				<option value="">1</option>
				<option value="">2</option>
				<option value="">3</option>
			</select>
			</td>
			</tr>
			</table>
			<!--  end paging................ -->
			
			<div class="clear"></div>

		</div>
		<!--  end content-table-inner ............................................END  -->	      
	
<?php elseif($action == 'add' || $action == 'edit' ): ?>   

	<form method="post" action="{url}/{page}/<?php echo $action == 'edit' ? 'update' : 'add'; ?>/">
		<input type="hidden" name="id" value="{id}" />
		<!--  start step-holder -->
		<div id="step-holder">
			<div class="step-no">1</div>
			<div class="step-dark-left"><?=$action?> <?=$caption?></div>
			<div class="step-dark-round">&nbsp;</div>
			<div class="clear"></div>
		</div>
		<!--  end step-holder -->
		
		<!-- start id-form -->
		
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		<tr>
			<th valign="top">Deal Category</th>
			<td>
				<select name="deal_category_id" class="styledselect_pages" style="width:150px">
					<option value="">--select--</option>
					<?php if (isset($categorydeallist)): ?>
                   			<?php foreach($categorydeallist as $dealcategory){ ?>
							<option value="<?=$dealcategory->id?>"   <?=(isset($deal->deal_category_id) && $deal->deal_category_id == $dealcategory->id)?"selected":""?>><?=$dealcategory->name?></option>
		                    <?php }?>
					<?php endif; ?> 
	    	</td>
			<td></td>
			
		<tr>
		<tr>
			<th valign="top">Tenant</th>
			<td>
				<select name="tenant_id" class="styledselect_pages" style="width:150px">
					<option value="">--select--</option>
					<?php if (isset($tenantlist)): ?>
                   			 <?php foreach($tenantlist as $tenant){ ?>
							<option value="<?=$tenant->tenant_id?>"   <?=(isset($deal->tenant_id) && $deal->tenant_id == $tenant->tenant_id)?"selected":""?>><?=$tenant->tenant_name?></option>
		                    <?php }?>
					<?php endif; ?> 
	    	</td>
			<td></td>
			
		<tr>
		</tr>
				
			<tr>
				<th valign="top">Item</th>
				<td>
					<input type="hidden" name="dealType" value="<?=(isset($deal->dealtype)?$deal->dealtype:'');?>">
					<select name="item_id" class="styledselect_pages" style="width:150px">
						<option value="">--select--</option>
						 <?php if (isset($itemlist)): ?>
                   			 <?php foreach($itemlist as $item){ ?>
								<option value="<?=$item->id?>"   <?=(isset($deal->item_id) && $deal->item_id == $item->id)?"selected":""?>><?=$item->name?></option>
			                    <?php }?>
						<?php endif; ?> 
			    	</select>
				</td>
				<td></td>
			</tr>
			
			<tr>
				<th valign="top">Offer Ends on</th>
				<td><input type="text" name="deal_end_date" id="deal_end_date" class="inp-form" value="<?=(isset($deal->deal_end_date)?$deal->deal_end_date:'');?>" />(YYYY-MM-DD)</td>
				<td></td>
			</tr>
					
			<tr>
				<th valign="top">Discount</th>
				<td><input type="text" name="discount" id="orderdate" class="inp-form" value="<?=(isset($deal->discount)?$deal->discount:'');?>" />%</td>
				<td></td>
			</tr>
			
					
			<tr>
				<th valign="top">Quantity</th>
				<td><input type="text" name="item_quantity" class="inp-form" value="<?=(isset($deal->item_quantity)?$deal->item_quantity:'');?>" /></td>
				<td></td>
			</tr>
			
							
			<tr>
				<th valign="top"></th>
				<th><input  type="checkbox" name="ishotdeal" value="1" <?=((isset($deal->ishotdeal) && $deal->ishotdeal == 1)?'checked':'');?>/>&nbsp;&nbsp;Is Hot Deal</th>
				<td></td>
			</tr>
			
			<tr>
				<th valign="top">Description</th>
				<td><textarea rows="" cols="" name="description" class="form-textarea"><?=(isset($deal->description)?$deal->description:'');?></textarea></td>
				<td></td>
			</tr>
			
			<tr>
				<th>&nbsp;</th>
				<td valign="top">
					<input type="submit" value="" class="form-submit" />
					<input type="reset" value="" class="form-reset"  />
				</td>
				<td></td>
			</tr>
		</table>
	</form>
	<!-- end id-form  -->	  
<?php endif; ?> 

<?php include 'includes/tablebottomcontainer.php';?>